From: Aaron Schulz Date: Tue, 18 Nov 2014 02:45:49 +0000 (-0800) Subject: Make eval.php try to handle newlines in code X-Git-Tag: 1.31.0-rc.0~12437 X-Git-Url: http://git.cyclocoop.org/%28%5B%5E/404?a=commitdiff_plain;h=f0ae292da7ef0673b30c68b4a6f3789b2eea8464;p=lhc%2Fweb%2Fwiklou.git Make eval.php try to handle newlines in code Change-Id: I9f4664bde6bea6f0e1dca0f4623553b9e849c83b --- diff --git a/maintenance/eval.php b/maintenance/eval.php index e20c477af0..3f10a33b51 100644 --- a/maintenance/eval.php +++ b/maintenance/eval.php @@ -60,6 +60,11 @@ if ( $__useReadline ) { readline_read_history( $__historyFile ); } +$__phpPath = preg_match( '/Zend Engine|HipHop VM/', wfShellExecWithStderr( 'php --version' ) ) + ? 'php' //standard system path name + : ''; // not accessible somehow + +$__multiLine = ''; $__e = null; // PHP exception while ( ( $__line = Maintenance::readconsole() ) !== false ) { if ( $__e && !preg_match( '/^(exit|die);?$/', $__line ) ) { @@ -74,8 +79,18 @@ while ( ( $__line = Maintenance::readconsole() ) !== false ) { readline_add_history( $__line ); readline_write_history( $__historyFile ); } + // Try to only run PHP once a valid chunk is formed (deals with newlines) + if ( $__phpPath ) { + $res = wfShellExecWithStderr( + "echo " . wfEscapeShellArg( "getMessage()}\n" . $__e->getTraceAsString() . "\n";